<template>
	<div>
		<el-drawer title="" :visible.sync="drawer" :direction="direction" :before-close="handleClose" custom-class="drawer-info">
			<div class="info-item">
				<h5 class="from-title">基本信息</h5>
				<div class="form-item">
					<label class="form-item-label">考试名称:</label>
					<div class="form-item-content">{{ objInfo.examName }}</div>
				</div>
				<!-- <div class="form-item">
					<label class="form-item-label">封面照片:</label>
					<div class="form-item-content">
						<el-image
							style="width: 100px; height: 100px"
							:src="objInfo.coverImg"
							:preview-src-list="[objInfo.coverImg]"
						></el-image>
					</div>
				</div> -->
				<div class="form-item">
					<label class="form-item-label">考试时长:</label>
					<div class="form-item-content">{{ objInfo.examTime || 0 }}分钟</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">考试说明:</label>
					<div class="form-item-content">{{ objInfo.examExplain }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">考试次数:</label>
					<div class="form-item-content">{{ objInfo.examNum }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">是否限制考试次数:</label>
					<div class="form-item-content">{{ isOrYes(objInfo.isLimited) }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">交卷后立马显示:</label>
					<div class="form-item-content">{{ isOrYes(objInfo.showAnswerTime) }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">考试时间:</label>
					<div class="form-item-content">{{ objInfo.examStartTime }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">考试结束时间:</label>
					<div class="form-item-content">{{ objInfo.examEndTime }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">单选题数量:</label>
					<div class="form-item-content">{{ objInfo.singleNum }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">单选题分数:</label>
					<div class="form-item-content">{{ objInfo.singleScore }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">多选题数量:</label>
					<div class="form-item-content">{{ objInfo.multipleNum }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">多选题分数:</label>
					<div class="form-item-content">{{ objInfo.multipleScore }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">合格分:</label>
					<div class="form-item-content">{{ objInfo.qualifiedScore }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">总分:</label>
					<div class="form-item-content">{{ objInfo.totalScore }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">状态:</label>
					<div class="form-item-content">{{ objInfo.statusName }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">是否乱序:</label>
					<div class="form-item-content">{{ isOrYes(objInfo.isOutOrder) }}</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">是否提醒:</label>
					<div class="form-item-content">{{ isOrYes(objInfo.isRemind) }}</div>
				</div>
				<div class="form-item" v-if="objInfo.isRemind == 1">
					<label class="form-item-label">考试开始前提醒:</label>
					<div class="form-item-content">{{ objInfo.startRemind || 0 }}分钟</div>
				</div>
				<div class="form-item" v-if="objInfo.isRemind == 1">
					<label class="form-item-label">考试结束前提醒:</label>
					<div class="form-item-content">{{ objInfo.endRemind || 0 }}分钟</div>
				</div>
				<div class="form-item">
					<label class="form-item-label">定时发布时间:</label>
					<div class="form-item-content">{{ objInfo.quartzTime }}</div>
				</div>
			</div>
		</el-drawer>
	</div>
</template>
<script>
import { studyexamInfo } from "@/api/study/exam/studyexam.js"
import { enumList } from "@/api/public.api.js"
export default {
	data() {
		return {
			drawer: true,
			direction: "rtl",
			objInfo: {},
			ExamStatusList: [],
		}
	},
	created() {},
	methods: {
		queryEnumList() {
			this.ExamStatusList = []
			enumList("ExamStatus", "").then(resp => {
				if (resp.code == 0) {
					this.ExamStatusList = resp.data
				}
			})
		},
		init(id) {
			this.queryEnumList()
			if (id) {
				studyexamInfo(id).then(res => {
					this.objInfo = res.data
					let statusObj = this.ExamStatusList.find(item => {
						return item.code == this.objInfo.status
					})
					this.objInfo.statusName = statusObj ? statusObj.name : ""
				})
			}
			this.drawer = true
		},
		// 关闭抽屉
		handleClose(done) {
			done()
		},

		isOrYes(data) {
			return data == 1 ? "是" : "否"
		},
	},
}
</script>
<style scoped>
.from-title {
	margin-bottom: 20px;
	padding: 0 20px 20px 20px;
	font-size: 16px;
	color: #17233d;
	border-bottom: 1px solid #eee;
}
.info-item {
	margin-bottom: 40px;
}

.form-item {
	margin-bottom: 20px;
	font-size: 14px;
}
.form-item-label {
	text-align: right;
	float: left;
	width: 25% !important;
}
.form-item-content {
	margin-left: 30%;
	width: 70%;
}
</style>
